package automatic.generate.code.data;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import org.misalen.annotations.DataAccess;
import org.misalen.annotations.Enumeration;

import automatic.generate.code.model.FiledData;

public class BulidDetailsFiled extends BulidFiled {

	@Override
	public List<FiledData> bulidFiledDatas(Field... fields) {
		List<FiledData> filedDatas = new ArrayList<>();
		for (Field field : fields) {
			if (isPass(field)) {
				continue;
			}
			DataAccess access = field.getAnnotation(DataAccess.class);
			if (access == null || access.details()) {
				Enumeration enumeration = field.getAnnotation(Enumeration.class);
				if (enumeration == null) {
					filedDatas.add(parsingFiled(field));
				} else {
					filedDatas.add(parsingEnumFiled(field));
				}
			}
		}
		return filedDatas;
	}
}
